package DataBaseUtils

import (
	"github.com/neo4j/neo4j-go-driver/v4/neo4j"
	"log"
)

var Neo4jConnection neo4j.Driver

func NewNeo4jConnect() {
	neo4jUrl := "bolt://" + configs.GetString("neo4j.address")
	neo4jUserName := configs.GetString("neo4j.userName")
	neo4jPasseword := configs.GetString("neo4j.userPasseword")
	log.Printf("neo4j初始化, 地址：%v，账户：%v，密码%v \n", neo4jUrl, neo4jUrl, neo4jPasseword)
	driver, err := neo4j.NewDriver(neo4jUrl, neo4j.BasicAuth(neo4jUserName, neo4jPasseword, ""))
	if err != nil {
		panic(err)
	}
	log.Printf("neo4j驱动初始化成功, %v \n", driver)
	Neo4jConnection = driver
}
